#include <rtthread.h>
#include <rtdevice.h>
#include "manager_timer.h"
#include "uc_seg_resend_manager.h"

static void seg_resend_test_timeout(void *parameter)
{
    t_seg_resend_manager *resend_manager = (t_seg_resend_manager *)parameter;
    rt_kprintf("%s line %d\n", __FUNCTION__, __LINE__);
    uc_reset_timeout(resend_manager->resend_seg_timer, resend_manager->timeout);
}

void uc_seg_resend_test(void)
{
    rt_kprintf("%s line %d\n", __FUNCTION__, __LINE__);

    while (1)
    {
        t_seg_resend_manager *resend_manager = packege_init_resend_seg_manager(seg_resend_test_timeout, RT_NULL, 100, 0, 0, 8);
        if (RT_NULL == resend_manager)
        {
            rt_kprintf("%s line %d packege_init_resend_seg_manager err\n", __FUNCTION__, __LINE__);
            continue;
        }

        rt_thread_delay(1000);
        packege_clear_resend_seg_manager(resend_manager);

        extern void print_memory_resource(void);
        print_memory_resource();
    }
}
